package bg.amazone.simpleDB.jpa.test;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import bg.amazone.simpleDB.jpa.UtilJPA;

public class MyTestObjectFactory {

	private static MyTestObjectFactory instance = new MyTestObjectFactory();

	public static MyTestObjectFactory getInstance() {
		return instance;
	}
	
	
	public List<MyTestObject> getListMyTestObject(){
		EntityManager entityManager =UtilJPA.getEntityManager();
		//Query query = entityManager.createQuery("select o from MyTestObject o where o.income = :income and o.age = :age");
		Query query = entityManager.createQuery("select o from MyTestObject o ");
		query.setParameter("income", 50507.0);
		query.setParameter("age", 12);
		List<MyTestObject> l = query.getResultList();
		return l;
	}
}
